try {
    Write-Host "Testing water_day_fact export..."
    $response = Invoke-WebRequest -Uri "http://localhost:8766/api/demo/export/water-day-fact" -Method POST -UseBasicParsing
    
    Write-Host "Status: $($response.StatusCode)"
    Write-Host "Content-Type: $($response.Headers.'Content-Type')"
    Write-Host "Size: $($response.Content.Length) bytes"
    
    if ($response.Headers.'Content-Type' -like "*excel*" -or $response.Headers.'Content-Type' -like "*spreadsheet*") {
        $filename = "water_day_fact_export.xlsx"
        [System.IO.File]::WriteAllBytes($filename, $response.Content)
        Write-Host "Excel file saved as: $filename"
    } else {
        Write-Host "Response content:"
        Write-Host $response.Content
    }
    
} catch {
    Write-Host "Error: $($_.Exception.Message)"
}
